package com.example.recyclerviewanimationtest

import android.os.Bundle
import android.view.animation.AnimationUtils
import android.view.animation.AnimationUtils.loadAnimation
import android.view.animation.LayoutAnimationController
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView


class MainActivity : AppCompatActivity() {

    private lateinit var recyclerView: RecyclerView
    private lateinit var fruitAdapter: FruitAdapter
    private val fruitList = ArrayList<String>()

    init {
        for (i in 1..50) {
            fruitList.add("我是王大锤".repeat(i))
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        recyclerView = findViewById(R.id.recyclerView)
        fruitAdapter = FruitAdapter(this, fruitList)
        recyclerView.layoutManager = LinearLayoutManager(this)
//        val controller =
//            LayoutAnimationController(loadAnimation(this, R.anim.animate))
//        recyclerView.layoutAnimation = controller
        recyclerView.adapter = fruitAdapter
    }
}